﻿using LPLS.Commons.DBModule;
using LPLS.DBEntities;
using LPLS.DBEntities.ConfigModels.AlarmModels.AlarmVarableCodeRuleConfigModels;
using LPLS.DBInterface.ConfigModels.AlarmModel.AlarmVarableCodeRuleConfigModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LPLS.DBServices.ConfigModels.AlarmModel.AlarmVarableCodeRuleConfigModels
{
    public class AlarmVarableCodeRuleConfigService : DBBaseService,IAlarmVarableCodeRuleConfigService
    {
        public AlarmVarableCodeRuleConfigService(DBContext dbContext) : base(dbContext)
        {
        }

      

        /// <summary>
        /// 获取报警变量代码规则配置数据
        /// </summary>
        /// <returns></returns>
        public List<AlarmVarableCodeRuleConfig> GetData()
        {
           return  this.Client.Queryable<AlarmVarableCodeRuleConfig>().ToList();
        }

        public override void InitDataBaseName()
        {
            DataBaseName= DatabaseEnum.SqliteConfig.ToString();
          
        }
        /// <summary>
        /// 保存报警变量代码规则配置数据
        /// </summary>
        /// <param name="alarmVarableCodeRuleConfigs"></param>
        /// <returns></returns>
        public int SaveData(List<AlarmVarableCodeRuleConfig> alarmVarableCodeRuleConfigs)
        {
          return   this.Client.Insertable(alarmVarableCodeRuleConfigs)
                .ExecuteCommand();
        }
    }
}
